<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="/js/vue.js"></script>
<title>Document</title>
<style>
    #app{
        width: 480px;
        margin: 40px auto;
    }
    .row{
        display: flex;
        font-size: 18px;
        margin-bottom: 5px;
        align-items: center;
    }
    .row-label{
        font-weight: bold;
        flex: 1.5;
    }
    .row-content{
        flex:3.5;
    }
    .wrapper {
        margin-bottom: 20px;
        width: 480px;
        border: 1px solid #ccc;
        border-radius: 5px;
        box-shadow: 0 2px 12px 0 rgb(0 0 0 /10%);
        padding: 20px;
    }
</style>
</head>
<body>
    <div id="app">
        <user></user>
        <user>
            <template v-slot:id="slotProps">
                <div class="row-label">姓名:</div>
                <div class="row-content">{{slotProps.user.name}}</div>
            </template>
        </user>
    </div>
</body>
<script type="text/x-template" id="user">
    <h2>个人信息</h2>
    <div class="row">
        <slot name="id" v-bind:user="user">
            <div class="row-label">ID:</div>
            <div class="row-content">{{user.id}}</div>
        </slot>
        <slot name="gender" >
            <div class="row-label">性别:</div>
            <div class="row-content">{{user.gender}}</div>
        </slot>
    </div>
    <div class="row">
        <slot name="age" >
            <div class="row-label">年龄:</div>
            <div class="row-content">{{user.age}}</div>
        </slot>
        <slot name="tel" >
            <div class="row-label">电话:</div>
            <div class="row-content">{{user.tel}}</div>
        </slot>
    </div>
</script>
<script>
    Vue.component('my-card',{
        template:'#my-card',
        data(){
            return{
                user:{
                    id:'01',
                    name:'张三',
                    gender:'男',
                    age:20,
                    tel:'8008820'
                }
            }
        }
    })
    let app =new Vue({
        el:"#app"
})
</script>

</html>